package org.ovirt.microvirt.services.vm;

import java.util.List;

import org.ovirt.microvirt.beans.VirtualMachine;
import org.ovirt.microvirt.services.VirtualMachineService;
import org.springframework.orm.jpa.support.JpaDaoSupport;

public class VirtualMachineServiceImpl extends JpaDaoSupport implements VirtualMachineService {

	@SuppressWarnings("unchecked")
	@Override
	public List<VirtualMachine> list() {
		return getJpaTemplate().find("select vm from "+VirtualMachine.class.getName() + " vm");
	}

	@Override
	public VirtualMachine persist(VirtualMachine vm) {
		getJpaTemplate().persist(vm);
		return vm;
	}

}
